ios git操作报错没有访问权限超时

拉取代码报错:

1
2
3
4
5
6
leon:317hu_iOS huanghaipo$ git pull
ssh: connect to host gitlab.317hu.com port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解决办法:

  1. 将原先的.ssh中的文件删除
    .ssh
  2. 生成新的.ssh文件
1
leon:~ huanghaipo$ ssh-keygen -t rsa -C "huanghp@317hu.com(自己的账号名)"

中途会让输入密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/huanghaipo/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/huanghaipo/.ssh/id_rsa.
Your public key has been saved in /Users/huanghaipo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA56:vL7UVl78DeXYWbukUCxdjbKHtYPfEXwTBbXcPj6I huanghp@317hu.com
The key's randomart image is:
+---[RSA 2048]----+
| . oo+.|
| o * =.=|
| o * % BB|
| .. . @.*=O|
| S o.o==+|
| oEo..ooo|
| o o .. .o|
| o . |
| o. |
+----[SHA256]-----+

  1. 输入命令查看公钥。
1
cat ~/.ssh/id_rsa.pub

查看公钥

4.将公钥复制到gitlab设置SSH Keys选项
将原来的删除,添加新的。
SSH Keys

-------------本文结束感谢您的阅读-------------

本文标题:ios git操作报错没有访问权限超时

文章作者:leon

发布时间:2019年04月24日 - 14:04

最后更新:2019年06月20日 - 17:06

原始链接:https://huanghaipo.github.io/2019/04/24/ios git操作报错/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

坚持原创技术分享,您的支持将鼓励我继续创作!